﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObjects;
using DemoObject;
using DemoObject.EntityMappers;

public partial class Controls_VideoHome : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TblTemplate item = TblTemplateRepository.CreateInstant().SelectOneByTextId("video-home ");
            if (item != null)
            {
                TblVideo itemvdieo = TblVideoRepository.CreateInstant().SelectOne(new Guid(item.Description));
                if (itemvdieo != null)
                {
                    if (itemvdieo.IsInternal)
                    {
                        TblTypeCode _TblTypeCode = TblTypeCodeRepository.CreateInstant().SelectOne((Guid)itemvdieo.VideoTypeCodeId);
                        VideoSource.Text = _TblTypeCode.Value.Replace("[width/]", "275").Replace("[height/]", "200").Replace("[source/]", itemvdieo.VideoSource);
                    }
                    else
                        VideoSource.Text = itemvdieo.VideoSource.Replace("[width/]", "275").Replace("[height/]", "200");
                }
            }
        }
    }
}
